﻿using Microsoft.AspNetCore.Mvc;
using MS.Core.Model;
using Net6Shell.Vo;
using ReportDesignerServer.DataModel;
using ReportDesignerServer.Services;

namespace ReportDesignerServer.Controllers
{

    /// <summary>
    /// RtmsRecordController
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RtmsRecordController : ControllerBase
    {
        RtmsRecordService Service;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="service"></param>
        public RtmsRecordController(RtmsRecordService service)
        {
            this.Service = service;
        }


        /// <summary>
        /// 通过月份组查询数据
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public Rt QueryRtmsRecord([FromBody] RtmsQueryModel query)
        {
            
            return Service.QueryRtmsRecord(query);
        }


        /// <summary>
        /// 通过id获取数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public Rt GetRtmsRecordById(string id)
        {
            return Service.GetRtmsRecordById(id);
        }

        /// <summary>
        /// 保存一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public Rt SaveRtmsRecord([FromBody] RtmsRecord model)
        {
            return Service.SaveRtmsRecord(model);
        }



        /// <summary>
        /// 添加多条经颅磁数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public Rt SaveRtmsRecords([FromBody] List<RtmsRecord> model)
        {
            return Service.SaveRtmsRecords(model);
        }


        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public Rt DelRtmsRecord([FromBody] RtmsRecord model)
        {
            return Service.DelRtmsRecord(model);
        }
    }
}
